<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns:v="livcos.org/ns/view"
  exclude-result-prefixes="html xs f v">
	
	<xsl:import href="doc/view.xsl"/>
	<xsl:param name="incl-toc" select="'0'"/>
	<xsl:param name="incl-tools" select="'0'"/>
	<xsl:param name="incl-chapter_numbering" select="'0'"/>
	
	<xsl:template match="/html:html/html:body">
		<body>
			<div class="contentPanel">
				<xsl:copy-of select="@id"/>
				<div class="content">
					<div class="header">
						<xsl:value-of select="../v:head/v:context"/>:	<b><xsl:value-of select="../v:head/v:title"/></b>
					</div>
					<table cellpadding="0" cellspacing="0" style="width: 100%">
						<tbody>
							<tr>
								<xsl:variable name="c" select="ceiling(count(v:chapter) div 4)"/>
								<td style="vertical-align: top; width: 25%;">
									<xsl:apply-templates select="v:chapter[position() &lt;= $c]"/>
								</td>
								<td style="vertical-align: top; width: 25%;">
									<xsl:apply-templates select="v:chapter[(position() &gt; $c) and (position() &lt;= $c * 2)]"/>
								</td>
								<td style="vertical-align: top; width: 25%;">
									<xsl:apply-templates select="v:chapter[(position() &gt; $c * 2) and (position() &lt;= $c * 3)]"/>
								</td>
								<td style="vertical-align: top; width: 25%;">
									<xsl:apply-templates select="v:chapter[position() &gt; $c * 3]"/>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</body>
	</xsl:template>
	
	<xsl:template match="/html:html/html:body/v:chapter">
		<div class="palette_entry">
			<xsl:apply-templates select="@*"/>
			<h1 class="palette_title">
				<xsl:apply-templates select="v:title" mode="inlineEdit"/>
			</h1>
			<xsl:apply-templates select="node()"/>
		</div>
	</xsl:template>
	
	<xsl:template name="head_ext">
		<link href="{f:caller-uri(resolve-uri('css/palette.css'))}" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
E.Config.get("EditMode").inEditMode = true;
    </script>
	</xsl:template>
	
</xsl:stylesheet>
